<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	template="/WEB-INF/template/template-interno1.xhtml">

	<ui:define name="conteudo-principal">
		<div style="width: 1000px;">
			<div align="left" style="float: left; width: 76%">
				<h:form id="formBusca">
					<div style="width: 50%;">
						<p:messages id="mensagens" autoUpdate="true" showDetail="false" />
					</div>
					<p:panel id="panelBusca" >
						<h:panelGrid columns="3">
							<p:inputText value="#{buscaBean.stringBusca}"> </p:inputText>
							<p:selectOneMenu id="tipo" height="5"
									required="true" label="Tipo"
									value="#{buscaBean.tipo}">
									<f:selectItem itemLabel="Todos" itemValue="TODOS" />
									<f:selectItem itemLabel="Familia" itemValue="FAMILIA" />
									<f:selectItem itemLabel="NegÃ³cios" itemValue="NEGOCIOS" />
									<f:selectItem itemLabel="Profissional"
										itemValue="VIDA_PROFISSIONAL" />
									<f:selectItem itemLabel="Relacionamento"
										itemValue="RELACIONAMENTO" />
									<f:selectItem itemLabel="Sexual" itemValue="VIDA_SEXUAL" />
									<f:selectItem itemLabel="Religioso" itemValue="RELIGIAO" />
							</p:selectOneMenu>
							<p:commandButton value="Buscar" id="buttonBuscar"
									update=":panelResultados panelBusca"  icon="ui-icon-disk"
									action="#{buscaBean.buscar}" />  
						</h:panelGrid>
						<p:blockUI id="blockBusca" trigger="buttonBuscar"
							block="panelBusca">
								Fazendo Busca.
							</p:blockUI>
					</p:panel>
				</h:form>
				<p:dataGrid id="panelResultados" var="post"
					value="#{buscaBean.resultados}" columns="1" rows="10" paginator="true"
					paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					currentPageReportTemplate="{currentPage} de {totalPages}"
					rowsPerPageTemplate="10,25,50">
					<f:facet name="header">Resultados Encontrados</f:facet>

					<h:form id="idConselho">
						<p:panel>
							<h:panelGroup>
								<p:outputLabel rendered="#{post.anonimo}" value="AlguÃ©m"
									style="color:green; font-weight: bold;" />
								<h:outputLink rendered="#{!post.anonimo}"
									style="color:green; font-weight: bold;"
									value="perfil.jsf?user=#{post.usuario.id}">
										#{post.usuario.nome}
									</h:outputLink>
								<p:outputLabel
									value=" quer conselho  sobre #{post.tipo.descricao}"
									style="color:green; font-weight: bold;" />
							</h:panelGroup>
							<div align="center">
								<p:separator style="width: 100%" />
							</div>
							<p
								style="padding-left: 10px; padding-right: 10px; font-family: serif; border: thin; font-size: large; border-color: black; max-width: inherit;">
								#{post.descricao}</p>
							<h:panelGroup
								rendered="#{sessaoBean.usuario.id != post.usuario.id}">
								<p:separator />
								<p:commandButton id="dialogAconselhamentoButton"
									value="Aconselhar" onclick="dialogAconselhar.show();"
									type="button" />
								<p:commandButton value="Seguir esse post"
									style="margin-right: 10px"
									rendered="#{sessaoBean.usuario.id != post.usuario.id}" />
								<p:dialog header="Aconselhamento" widgetVar="dialogAconselhar"
									showEffect="clip" hideEffect="clip" height="170">
									<h:panelGrid columns="1" cellpadding="5">
										<h:outputText value="DÃª o seu conselho Ã  este post:" />
										<p:inputTextarea value="#{conselhoBean.descricao}" rows="5"
											cols="100" />
										<p:commandButton value="Aconselhar"
											action="#{conselhoBean.aconselhar(post)}"
											onclick="dialogAconselhar.hide();" />
									</h:panelGrid>

								</p:dialog>
							</h:panelGroup>
							<h:panelGroup
								rendered="#{sessaoBean.usuario.id == post.usuario.id}" />

						</p:panel>
					</h:form>
				</p:dataGrid>
			</div>
			<div style="float: right; padding: 20px; width: 20%;" align="center">
				<p:outputLabel value="MEDALHAS PESSOAIS" style="font-weight: bold;" />
				<br /> <b>PARTICIPAÃ‡ÃƒO</b>
				<p:separator />
				23 relatos <br /> 47 conselhos <br />
				<p:separator />
				<br /> <br />
				<p:separator />
				<b>TITULAÃ‡Ã•ES</b>
				<p:separator />
				NÃ­vel atual: ESPECIALISTA <br /> Ã�rea: FAMÃ�LIA
				<p:separator />
			</div>
		</div>
	</ui:define>
</ui:composition>